package com.itany.corejava.code09_集合.map集合;

import java.util.Enumeration;
import java.util.Properties;

/**
 * @author 石小俊
 * @date 2023年05月08日 16:04
 */
public class Test06_获取系统属性 {

    public static void main(String[] args) {
        // 获取所有的系统属性配置
        Properties properties = System.getProperties();
        System.out.println(properties);
        Enumeration<Object> keys = properties.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            String value = properties.getProperty(key);
            System.out.println(key + "=" + value);
        }

        // 根据key获取指定的属性值
        System.out.println("javaHome:" + System.getProperty("java.home"));
        System.out.println("编码:" + System.getProperty("file.encoding"));
        System.out.println("java版本:" + System.getProperty("java.version"));
    }

}
